package com.example.userservice.permission;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
@Component
public class PermissionCheckerFactory {
    @Autowired
    private Map<String, PermissionChecker> permissionCheckerMap ;
    public PermissionChecker getPermissionChecker(String roleCode) {
        PermissionChecker permissionChecker = permissionCheckerMap.get(roleCode);
        System.out.println("permissionCheckerMap keys2 = " + permissionCheckerMap.keySet());
        if (permissionChecker == null) {
            throw new RuntimeException("角色错误");
        }
        return permissionChecker;
    }
}
